package xq.gwt.mvc.server;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import xq.gwt.mvc.util.DateFormatter;

public class ServerDateFormatter implements DateFormatter {

	@Override
	public String format(Date val, String format) {
		DateFormat df = new SimpleDateFormat(format);
		return df.format(val);		
	}

	@Override
	public Date parse(String val, String format) throws Exception {
		DateFormat df = new SimpleDateFormat(format);
		Date dateVal = df.parse(val);
		return dateVal;
	}

}
